package com.qs.education.service.impl;

import java.util.List;

import org.springframework.stereotype.Service;
import com.qs.education.bean.api.ResponseListBean;
import com.qs.education.bean.entity.EducationSubjectUnit;
import com.qs.education.bean.enums.ResponseStatus;
import com.qs.education.bean.service.BaseService;
import com.qs.education.service.ISubjectUnitAPIService;

/**
 * @class SubjectUnitAPIServiceImpl
 * @author Leon
 * @description
 * @date Nov 19, 2018
 */
@Service
public class SubjectUnitAPIServiceImpl extends BaseService implements ISubjectUnitAPIService {

	@Override
	public ResponseListBean<EducationSubjectUnit> findSubjectUnitByGradeAndSubject(EducationSubjectUnit subjectUnit) {
		ResponseListBean<EducationSubjectUnit> unit = new ResponseListBean<EducationSubjectUnit>();
		List<EducationSubjectUnit> unitList = null;
		try {
			unitList = iEducationSubjectUnitDao.findSubjectUnitByGradeAndSubject(subjectUnit);
			unit.setList(unitList);
			unit.setStatus(ResponseStatus.SUCCESS.toString());
		} catch (Exception e) {
			unit.setStatus(ResponseStatus.FAILED.toString());
			e.printStackTrace();
		}
		return unit;
	}

}
